import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import {fileURLToPath, URL} from 'node:url'
import tsconfigPaths from 'vite-tsconfig-paths';

export default defineConfig({
    plugins: [
        vue(),
        tsconfigPaths()
    ],
    define: {
        global: {}
    },
    resolve: {
        alias: {
            '@': fileURLToPath(new URL('./src', import.meta.url))
        },
    },
    server: {
        port: 5173,
        proxy: {
            '/api': {
                target: 'http://localhost:8080',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/api/, ""),
            },
            '/amap-api': {
                target: 'https://restapi.amap.com',
                changeOrigin: true,
                rewrite: (path) => path.replace(/^\/amap-api/, ""),
            }
        }
    }
})
